<template>
  <div class="wrapper" ref="wrapper">
      <div class="content">
      <slot></slot>
      </div>
  </div>
</template>


<script>
import BScroll from 'better-scroll'
export default {
    name:'bscroll',
    data () {
        return {
            scroll: null,
        }
    },
    props:{
        probetype:{
            type:Number,
            default:0
        },
        pullupload:{
            type:Boolean,
            default:true
        }
    },
    mounted () {
        this.scroll = new BScroll(this.$refs.wrapper,{
            probeType:this.probetype,
            pullUpLoad:this.pullupload,
            observeDOM:true,
            click:true,
            observeImage:true
        }),
        this.scroll.on('scroll',(position)=>{
            // console.log(position);
            this.$emit('scroll', position)
        })
        this.scroll.on('pullingUp',()=>{
            // console.log('加载更多');
            this.$emit('pullingUp')
        })
    },
    methods: {
        getScrollY(){
            return this.scroll ? this.scroll.y : 0           
        }
    }
}
</script>

<style scoped>
.wrapper{
    height: 100%;
}
</style>